]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
runDialog: Disable internal commands if parental controls are enabled
authorPhilip Withnall <pwithnall@gnome.org>
Thu, 20 Nov 2025 16:37:58 +0000 (16:37 +0000)
committerPhilip Withnall <pwithnall@gnome.org>
Thu, 20 Nov 2025 18:29:40 +0000 (18:29 +0000)
This reduces the chance of the child user being able to monkey patch
gnome-shell to disable things like screen time limits using Looking
Glass.

Spotted by Sergey Bugaev.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3968>

js/ui/runDialog.js

index 89ae38190457262341c9554e64fba106fd2cca43..faf9e0e0ec2d5a71a2bb1c8ef27b4f276abbf0a1 100644 (file)
@@ -8,6 +8,7 @@ import St from 'gi://St';
 import * as Dialog from './dialog.js';
 import * as Main from './main.js';
 import * as ModalDialog from './modalDialog.js';
+import * as ParentalControlsManager from '../misc/parentalControlsManager.js';
 import * as ShellEntry from './shellEntry.js';
 import * as Util from '../misc/util.js';
 import * as History from '../misc/history.js';
@@ -29,6 +30,11 @@ class RunDialog extends ModalDialog.ModalDialog {
             destroyOnClose: false,
         });
 
+        this._parentalControlsManager = ParentalControlsManager.getDefault();
+        this._parentalControlsManager.connect('notify::any-parental-controls-enabled', () => {
+            this._updateEnableInternalCommands();
+        });
+
         this._lockdownSettings = new Gio.Settings({schema_id: LOCKDOWN_SCHEMA});
         this._terminalSettings = new Gio.Settings({schema_id: TERMINAL_SCHEMA});
         global.settings.connect('changed::development-tools', () => {
@@ -119,7 +125,9 @@ class RunDialog extends ModalDialog.ModalDialog {
     }
 
     _updateEnableInternalCommands() {
-        this._enableInternalCommands = global.settings.get_boolean('development-tools');
+        this._enableInternalCommands =
+            !this._parentalControlsManager.anyParentalControlsEnabled &&
+            global.settings.get_boolean('development-tools');
     }
 
     vfunc_key_press_event(event) {